home *** CD-ROM | disk | FTP | other *** search
- { (C) Patrik Spanel 1998}
- unit Dbchemtx;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, DBCtrls;
-
- type
- TDBChemText = class(TDBText)
- private
- { Private declarations }
- procedure DoDrawChemText(var Rect: TRect; Flags: Word);
- protected
- { Protected declarations }
- procedure Paint;override;
- public
- { Public declarations }
- published
- { Published declarations }
- end;
-
- TChemLabel = class(TLabel)
- private
- { Private declarations }
- procedure DoDrawChemText(var Rect: TRect; Flags: Word);
- protected
- { Protected declarations }
- procedure Paint;override;
- public
- { Public declarations }
- published
- { Published declarations }
- end;
-
- implementation
- uses ChemTxt;
-
- procedure TDBChemText.DoDrawChemText(var Rect: TRect; Flags: Word);
- begin
- Canvas.Font := Font;
- if not Enabled then Canvas.Font.Color := clGrayText;
- ChemTextOut(Canvas, Rect, Rect.Left, Rect.Top, Caption);
- end;
-
- procedure TDBChemText.Paint;
- const
- Alignments: array[TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER);
- var
- Rect: TRect;
- begin
- with Canvas do
- begin
- if not Transparent then
- begin
- Brush.Color := Self.Color;
- Brush.Style := bsSolid;
- FillRect(ClientRect);
- end;
- Brush.Style := bsClear;
- Rect := ClientRect;
- DoDrawChemText(Rect, (DT_EXPANDTABS or DT_WORDBREAK) or
- Alignments[Alignment]);
- end;
- end;
-
- procedure TChemLabel.DoDrawChemText(var Rect: TRect; Flags: Word);
- begin
- Canvas.Font := Font;
- if not Enabled then Canvas.Font.Color := clGrayText;
- ChemTextOut(Canvas, Rect, Rect.Left, Rect.Top, Caption);
- end;
-
- procedure TChemLabel.Paint;
- const
- Alignments: array[TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER);
- var
- Rect: TRect;
- begin
- with Canvas do
- begin
- if not Transparent then
- begin
- Brush.Color := Self.Color;
- Brush.Style := bsSolid;
- FillRect(ClientRect);
- end;
- Brush.Style := bsClear;
- Rect := ClientRect;
- DoDrawChemText(Rect, (DT_EXPANDTABS or DT_WORDBREAK) or
- Alignments[Alignment]);
- end;
- end;
-
-
- end.
-